package com.yc.springmvc.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller  // 默认返回值是表示 要跳转的页面
@RequestMapping("web")
public class MyIndexAction {

    // web/hello1
    @RequestMapping("hello1")
    @ResponseBody   // 将返回值转为  json
    String hello(String name){
        return "hello " + name;
    }

    // web/toPage1
    @RequestMapping("toPage1")
    String toPage(String page){
        page = page == null ? "A":page;
        return "redirect:/" + page + ".html";
    }

    // web 的相对路径和绝对路径的区别
}
